home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0493 / UGETMID.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-29  |  1KB  |  42 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 568 of 570
  3. From : John Reid                           1:150/170.0          24 Apr 93  14:16
  4. To   : Mark Gryn
  5. Subj : Diskette Serial Numbers
  6. ────────────────────────────────────────────────────────────────────────────────
  7.  
  8. MG>        If anyone happens to know how to find the serial number of a
  9. MG>        diskette, please let me know, code is nice :)
  10.  
  11. This should probably have code added to check for early DOS versions
  12. that do not support media id.  }
  13.  
  14. unit ugetmid; {Get media ID}
  15. INTERFACE
  16. uses dos;
  17. type
  18.   TMID = record
  19.            InfoLevel : word;
  20.            SN : array[0..1] of word;
  21.            Labl : array[1..11] of byte;
  22.            Typ : array[1..8] of byte;
  23.          end;
  24.  
  25. procedure GetMediaID(Drive : byte; {0=default, 1=A:, 2=B:, 3=C:, etc.}
  26.                      var MID : TMID);
  27.  
  28. IMPLEMENTATION
  29. procedure GetMediaID(Drive : byte; var MID : TMID) ;
  30.   var
  31.     Regs : registers;
  32.   begin
  33.     Regs.bx := Drive;
  34.     Regs.ch := $08;
  35.     Regs.cl := $66;
  36.     Regs.ds := Seg(MID);
  37.     Regs.dx := Ofs(MID);
  38.     Regs.ax := $440D;
  39.     MsDos(Regs)
  40.   end;
  41.  
  42. END.